package fr.axones.pocketagile.services.local
{
	import flash.events.EventDispatcher;
	import flash.net.SharedObject;
	
	import fr.axones.pocketagile.vo.UserVO;

	public class UserService extends EventDispatcher
	{
		public function UserService()
		{
		}
		
		public function saveUser(user:UserVO):void
		{
			var so:SharedObject = SharedObject.getLocal("storage");
			
			so.data["user"] = user;
			
			so.close();
		}
		
		public function getUser():UserVO
		{
			var so:SharedObject = SharedObject.getLocal("storage");
			
			var user:UserVO = so.data["user"];
			
			so.close();
			
			return user;
		}
		
		public function removeUser():void
		{
			var so:SharedObject = SharedObject.getLocal("storage");
			
			so.data["user"] = null;
			
			so.close();
		}
	}
}